<include file="Common:layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default;">
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>代理等级管理</h3>
                <h5>代理等级管理和添加</h5>
            </div>
        </div>
    </div>
    <div id="explanation" class="explanation">
        <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">自由设置代理级别是否包邮！</h4>
            <span title="收起提示" id="explanationZoom"></span>
        </div>
        <ul>
            <li></li>
        </ul>
    </div>
    <form method="post">
        <input type="hidden" value="ok" name="form_submit">
        <div class="flexigrid">
            <div class="mDiv">
                <div class="ftitle">
                    <h3>代理等级列表</h3>
                    <h5></h5>
                </div>
            </div>
            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0">
                        <thead>
                        <tr>
                            <th align="center" axis="col1"><div style="text-align: left; width:60px;">ID</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 180px;">代理名称</div></th>
                            <th align="center" axis="col3"><div style="text-align: center; width: 60px;">是否包邮</div></th>
                            <th align="center" axis="col3"><div style="text-align: center; width: 160px;">操作</div></th>
                            <th axis="col10"><div></div></th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="tDiv">
                <!--<div class="tDiv2">
                    <a href="{:U('Agent/add_rank',array('id' =>$brand_id))}">
                        <div class="fbutton">
                            <div title="新增级别" class="add">
                                <span><i class="fa fa-plus"></i>新增级别</span>
                            </div>
                        </div>
                    </a>
                </div>-->
                <div style="clear:both"></div>
            </div>
            <div style="height: auto;" class="bDiv">
                <table cellspacing="0" cellpadding="0" border="0" id="article_cat_table" class="flex-table autoht">
                    <tbody id="treet1">
                    <volist name="ranks" id="rank">
                        <td class="sort">
                            <div style="text-align: center; width: 60px;">{$i}</div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 180px;">
                                <input type="text" value="{$rank['rank_name']}" onchange="changeTableVal('agentRank','rank_id','{$rank[rank_id]}','rank_name',this)" style="text-align: left; width:160px;"/>
                            </div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 60px;">
                                <if condition='$rank[is_free] eq 1'>
                                    <span class="yes" onClick="changeGoodsVal('agent_rank','rank_id','{$rank.rank_id}','is_free',this)" ><i class="fa fa-check-circle"></i>是</span>
                                    <else />
                                    <span class="no" onClick="changeGoodsVal('agent_rank','rank_id','{$rank.rank_id}','is_free',this)" ><i class="fa fa-ban"></i>否</span>
                                </if>
                            </div>
                        </td>
                        <td>
                            <div style="text-align:left;width:160px!important; max-width:inherit !important;">
                                <a href="{:U('Agent/edit_rank',array('id' => $rank['rank_id']))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
                                <if condition="$i neq 1">
                                    <a href="javascript:;" data-id="{$rank['rank_id']}" class="del_rank btn red"><i class="fa fa-trash-o"></i>删除</a>
                                </if>
                            </div>
                        </td>
                        <td style="width: 100%;">
                            <div>&nbsp;</div>
                        </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
                <br/>
            </div>
        </div>
    </form>
</div>
<script>
    $(document).ready(function(){
            $(".del_rank").click(function(){
                var rid = $(this).attr("data-id");
                var _this = $(this);

                layer.confirm('您确认删除此层级吗？', {
                    btn: ['是的','点错了'] //按钮
                }, function(){
                    $.ajax({
                        url: "{:U('Agent/rank_del')}",
                        type: "post",
                        dataType : 'json',
                        data: {rank_id: rid},
                        success: function (msg)
                        {
                            if(msg.status == 'success'){
                                layer.msg('删除成功!', {icon: 1,time:1000});
                                window.location.reload();
                            }else{
                                layer.alert(msg.msg);
                            }
                        }
                    });
                });
            });
    });

</script>
</body>
</html>